package com.itjiange.service.question.controller.inner;

import com.itjiange.model.entity.Question;
import com.itjiange.model.entity.QuestionSubmit;
import com.itjiange.service.client.QuestionFeignClient;
import com.itjiange.service.question.service.QuestionService;
import com.itjiange.service.question.service.QuestionSubmitService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author ItJianGe
 * @data 2024/4/8 11:21
 */
@RestController
@RequestMapping("/inner")
public class QuestionInnerController implements QuestionFeignClient {

    @Resource
    private QuestionSubmitService questionSubmitService;

    @Resource
    private QuestionService questionService;

    @Override
    @GetMapping("/get/question/{id}")
    public Question getQuestionById(@PathVariable("id") long id) {
        return questionService.getById(id);
    }

    @Override
    @GetMapping("/get/question_submit/{id}")
    public QuestionSubmit getQuestionSubmitById(@PathVariable("id") long id) {
        return questionSubmitService.getById(id);
    }

    @Override
    @PutMapping("/update/question_submit")
    public boolean updateById(@RequestBody QuestionSubmit questionSubmit) {
        return questionSubmitService.updateById(questionSubmit);
    }
}
